home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6192 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  43 lines

  1. Path: news.magicnet.net!usenet
  2. From: gamecox@magicnet.net (Jody Hagins)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Pure Virtual Destructor Question
  5. Date: 11 Feb 1996 01:39:27 GMT
  6. Organization: MagicNet, Inc.
  7. Message-ID: <4fjhcf$8v0@comet2.magicnet.net>
  8. References: <4fecq0$k4e@news4.digex.net> <4fg2s5$r02@cnn.exu.ericsson.se>
  9. NNTP-Posting-Host: pm1-04.magicnet.net
  10. X-Newsreader: WinVN 0.92.6+
  11.  
  12. In article <4fg2s5$r02@cnn.exu.ericsson.se>, ebumow@ebu.ericsson.com (Mickey Williams 66753) says:
  13. >
  14. >In article k4e@news4.digex.net,  ell@access4.digex.net (Ell) writes:
  15. >
  16. >>Immediately above you are logically "defining" your "pure virtual" 
  17. >>destructor "inside the class where it is "declared" as a pure virtual
  18. >>function.  It is _illegal_ to logically, or physically "define" a pure
  19. >>virtual function in the class it is "declared" in.  A pure virtual should
  20. >>only be defined in classes derived from the class where the pure virtual
  21. >>is declared.  Only derived classes should "do some destructor stuff".
  22. >
  23. >This is not true in the case of pure virtual destructors. You must
  24. >always provide a function body for a virtual dtor, even if it
  25. >is pure.
  26.  
  27. It's not even true for other virtual functions.  However, you stated
  28. what I want, sort of.  I want to do the following, but as an
  29. "in-the-class-declaration-inline-function"
  30.  
  31. class Foo
  32. {
  33. public:
  34.   virtual ~Foo() = 0;
  35. };
  36.  
  37. Foo::~Foo()
  38. {
  39.   // do something
  40. }
  41.  
  42.     -Jody
  43.